package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.query.QuestionAdminPageQuery;
import com.tianji.learning.domain.vo.QuestionAdminVO;
import com.tianji.learning.domain.vo.QuestionVO;
import com.tianji.learning.service.IAdminInteractionQuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 互动提问的问题表 前端控制器
 * </p>
 *
 * @author yb0os1
 * @since 2024-12-24
 */
@Api(tags = "管理端提问相关接口")
@RestController
@RequestMapping("/admin/questions")
@RequiredArgsConstructor
public class AdminInteractionQuestionController {
    private final IAdminInteractionQuestionService adminInteractionQuestionService;
    @ApiOperation("管理端分页查询问题列表")
    @GetMapping("/page")
    public PageDTO<QuestionAdminVO> pageQueryQuestion(QuestionAdminPageQuery page) {
        return adminInteractionQuestionService.pageQueryQuestion(page);
    }

    @ApiOperation("管理端根据id查询问题详情")
    @GetMapping("/{id}")
    public QuestionAdminVO queryQuestionById(@PathVariable Long id) {
        return adminInteractionQuestionService.queryQuestionById(id);
    }

    @ApiOperation("管理端隐藏或显示问题")
    @PutMapping("/{id}/hidden/{hidden}")
    public void updateHiddenStatus(@PathVariable Long id, @PathVariable Boolean hidden) {
        adminInteractionQuestionService.updateStatus(id, hidden);
    }
}
